package com.traveldream.beans.utility;

import java.util.LinkedHashMap;
import java.util.List;

import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

import com.traveldream.entities.Place;
import com.traveldream.entity_managers.PlaceManager;

@ManagedBean(name="util")
@SessionScoped
public class UtilBean {
	@EJB
	private PlaceManager placeManager;
	
	public LinkedHashMap<String,String> getPlaceListOptions() {
		List<Place> placeList = placeManager.findAll();
		//return placeList;
		LinkedHashMap<String,String> ret = new LinkedHashMap<String,String>();
		for(Place item:placeList)
		{
			ret.put(item.getName(),item.getName()); //label, value
		}
		
		return ret;
	}
	
	
}
